package com.xgimi.open.skill.datamanager.biz.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.xgimi.open.skill.datamanager.biz.service.IntentSlotBizService;
import com.xgimi.open.skill.datamanager.domain.entity.IntentSlotDO;
import com.xgimi.open.skill.datamanager.domain.service.IntentSlotService;
import com.xgimi.open.skill.datamanager.service.response.IntentSlotRespDTO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author coderzpw.zhang
 * @version 1.0
 * @description 描述
 * @date 2023/4/13 9:52
 */
@Service
public class IntentSlotBizServiceImpl implements IntentSlotBizService {
    @Autowired
    private IntentSlotService intentSlotService;
    @Override
    public List<IntentSlotRespDTO> listByIntentIds(List<Long> intentIds) {
        List<IntentSlotDO> intentSlotDOS = intentSlotService.listByIntentIds(intentIds);
        List<IntentSlotRespDTO> ret = intentSlotDOS.stream().map(x -> {
            IntentSlotRespDTO intentSlotRespDTO = new IntentSlotRespDTO();
            BeanUtils.copyProperties(x, intentSlotRespDTO);
            return intentSlotRespDTO;
        }).collect(Collectors.toList());
        return ret;
    }
}
